package crm.view.campaign;

import java.awt.Dimension;
import java.awt.Font;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JToolBar;
import javax.swing.SpringLayout;

import crm.controller.CampaignHomeController;
import crm.controller.CampaignMgmtController;
import crm.viewframework.UIFrameWork;



@SuppressWarnings("serial")
public class CampaignView extends JPanel implements MouseListener
{
	private SpringLayout springLayout;
	private JToolBar toolBar;

	public CampaignView() 
	{
		springLayout = new SpringLayout();
		setLayout(springLayout);
		toolBar=UIFrameWork.addToolBar(this, springLayout);
		String[]leftMenuNames={"Home","Campaign Managment","Campaign Reports"};
		JLabel[]leftMenu=UIFrameWork.setLeftMenu(leftMenuNames,toolBar, new Dimension(180, 40));
	    Font font=new Font("MS Reference Sans Serif", Font.PLAIN, 13);
	    UIFrameWork.styleLeftMenu(leftMenu, font, null,null);	
	}
	
	@SuppressWarnings("unused")
	@Override
	public void mouseClicked(MouseEvent arg0) 
	{	
		if(arg0.getSource() instanceof JLabel)
		{
			JLabel label=(JLabel) arg0.getSource();
			if(label.getText().equals("Home"))
			{
				CampaignHome home =  new CampaignHome();
				CampaignHomeController controller = new CampaignHomeController(home,null);
			
				UIFrameWork.setReportComponent(springLayout,home,this,2);
			}
			if(label.getText().equals("Campaign Managment"))
			{
				
				CampaignManagment managment=new CampaignManagment();
				UIFrameWork.setFormComponent(springLayout,managment,this,2);
				CampaignMgmtController controller=new CampaignMgmtController(managment,null);	
			}
			
			if(label.getText().equals("Campaign Reports"))
			{
				UIFrameWork.setFormComponent(springLayout, new JPanel(),this,2);
			}
		}
	}
	
	@Override
	public void mouseEntered(MouseEvent arg0) 
	{
		
	}
	@Override
	public void mouseExited(MouseEvent arg0) 
	{
		
	}
	@Override
	public void mousePressed(MouseEvent arg0) 
	{
		
	}
	@Override
	public void mouseReleased(MouseEvent arg0) 
	{
		
	}
}
